{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Importing Packages\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import pandas as pd\n",
    "from math import comb\n",
    "import pickle"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Parameters**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "v=10\n",
    "lam=.125\n",
    "c=1\n",
    "T=10\n",
    "N=2\n",
    "\n",
    "period=10"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Last Period (FS>0)**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def f_enterF(pf,y,N):\n",
    "    return (comb(N-2,y)*((pf**y)*(1-pf)**(N-2-y)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def f_enterL(pf,y,N):\n",
    "    return (comb(N-1,y)*((pf**y)*(1-pf)**(N-1-y)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def last_period_0(FS,initial):\n",
    "    \n",
    "    p=initial[0]\n",
    "    old=5\n",
    "    \n",
    "    j=0\n",
    "    while ((abs(p-old))>1e-6):\n",
    "        vDraw=v*sum([comb(N-1,y)*(p**y)*((1-p)**(N-1-y))*(1/(y+1)) for y in range(N)])-c\n",
    "\n",
    "        vNoDraw=v*((1-p)**(N-1))*(1/N)\n",
    "\n",
    "        old=p\n",
    "\n",
    "        #Gets too big, have to adjust for this\n",
    "        p=(np.exp(mu*(vDraw-max(vDraw,vNoDraw))))/(np.exp(mu*(vDraw-max(vDraw,vNoDraw)))+np.exp(mu*(vNoDraw-max(vDraw,vNoDraw))))\n",
    "    \n",
    "    payoff=p*vDraw + (1-p)*vNoDraw\n",
    "    \n",
    "    return p,payoff"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def last_period(FS,initial):\n",
    "    \n",
    "    pl=initial[0]\n",
    "    pf=initial[1]\n",
    "\n",
    "    oldl=5\n",
    "    oldf=5\n",
    "    \n",
    "    epsilon=1\n",
    "    \n",
    "    #Follower\n",
    "    iteration=0\n",
    "    while ((abs(pl-oldl)+abs(pf-oldf))>1e-6)&(iteration<6):\n",
    "        vFollowerDrawFirst=v*(1-pl)*(sum([(f_enterF(pf,y,N))*sum([comb(y,z)*(1/(z+1))*((1-FS)**(z+1))*(FS**(y-z)) for z in range(y+1)]) for y in range(N-1)]))\n",
    "        vFollowerDrawSecond=v*pl*(sum([(f_enterF(pf,y,N))*sum([comb(y,z)*(1/(z+1))*((1-FS)**(z+1))*(FS**(y+1-z)) for z in range(y+1)]) for y in range(N-1)]))\n",
    "        vFollowerDrawThird=v*pl*(sum([(f_enterF(pf,y,N))*sum([comb(y,z)*(1/(z+2))*((1-FS)**(z+2))*(FS**(y-z)) for z in range(y+1)]) for y in range(N-1)]))\n",
    "        vFollowerDraw=vFollowerDrawFirst+vFollowerDrawSecond+vFollowerDrawThird-c\n",
    "        vFollowerNoDraw=0\n",
    "\n",
    "        #Leader\n",
    "\n",
    "        vLeaderNoDraw=v*sum([f_enterL(pf,y,N)*(FS**y) for y in range(N)])\n",
    "        vLeaderDrawFirst=v*sum([f_enterL(pf,y,N)*(FS**(y+1)) for y in range(N)])\n",
    "        vLeaderDrawSecond=v*sum([f_enterL(pf,y,N)*sum([comb(y,z)*(1/(z+1))*((1-FS)**(z+1))*((FS)**(y-z)) for z in range(y+1)]) for y in range(N)])\n",
    "        vLeaderDraw=vLeaderDrawFirst+vLeaderDrawSecond-c\n",
    "\n",
    "        oldl=pl\n",
    "        oldf=pf\n",
    "\n",
    "        #Gets too big, have to adjust for this\n",
    "        pfU=(np.exp(mu*(vFollowerDraw-max(vFollowerDraw,vFollowerNoDraw))))/(np.exp(mu*(vFollowerDraw-max(vFollowerDraw,vFollowerNoDraw)))+np.exp(mu*(vFollowerNoDraw-max(vFollowerDraw,vFollowerNoDraw))))\n",
    "        plU=(np.exp(mu*(vLeaderDraw-max(vLeaderDraw,vLeaderNoDraw))))/(np.exp(mu*(vLeaderDraw-max(vLeaderDraw,vLeaderNoDraw)))+np.exp(mu*(vLeaderNoDraw-max(vLeaderDraw,vLeaderNoDraw))))\n",
    "        \n",
    "        pl=(1-epsilon)*oldl + epsilon*plU\n",
    "        pf=(1-epsilon)*oldf + epsilon*pfU\n",
    "        \n",
    "        iteration=iteration+1\n",
    "        \n",
    "    epsilon=.01\n",
    "    while ((abs(pl-oldl)+abs(pf-oldf))>1e-6):\n",
    "        vFollowerDrawFirst=v*(1-pl)*(sum([(f_enterF(pf,y,N))*sum([comb(y,z)*(1/(z+1))*((1-FS)**(z+1))*(FS**(y-z)) for z in range(y+1)]) for y in range(N-1)]))\n",
    "        vFollowerDrawSecond=v*pl*(sum([(f_enterF(pf,y,N))*sum([comb(y,z)*(1/(z+1))*((1-FS)**(z+1))*(FS**(y+1-z)) for z in range(y+1)]) for y in range(N-1)]))\n",
    "        vFollowerDrawThird=v*pl*(sum([(f_enterF(pf,y,N))*sum([comb(y,z)*(1/(z+2))*((1-FS)**(z+2))*(FS**(y-z)) for z in range(y+1)]) for y in range(N-1)]))\n",
    "        vFollowerDraw=vFollowerDrawFirst+vFollowerDrawSecond+vFollowerDrawThird-c\n",
    "        vFollowerNoDraw=0\n",
    "\n",
    "        #Leader\n",
    "\n",
    "        vLeaderNoDraw=v*sum([f_enterL(pf,y,N)*(FS**y) for y in range(N)])\n",
    "        vLeaderDrawFirst=v*sum([f_enterL(pf,y,N)*(FS**(y+1)) for y in range(N)])\n",
    "        vLeaderDrawSecond=v*sum([f_enterL(pf,y,N)*sum([comb(y,z)*(1/(z+1))*((1-FS)**(z+1))*((FS)**(y-z)) for z in range(y+1)]) for y in range(N)])\n",
    "        vLeaderDraw=vLeaderDrawFirst+vLeaderDrawSecond-c\n",
    "\n",
    "        oldl=pl\n",
    "        oldf=pf\n",
    "\n",
    "        #Gets too big, have to adjust for this\n",
    "        pfU=(np.exp(mu*(vFollowerDraw-max(vFollowerDraw,vFollowerNoDraw))))/(np.exp(mu*(vFollowerDraw-max(vFollowerDraw,vFollowerNoDraw)))+np.exp(mu*(vFollowerNoDraw-max(vFollowerDraw,vFollowerNoDraw))))\n",
    "        plU=(np.exp(mu*(vLeaderDraw-max(vLeaderDraw,vLeaderNoDraw))))/(np.exp(mu*(vLeaderDraw-max(vLeaderDraw,vLeaderNoDraw)))+np.exp(mu*(vLeaderNoDraw-max(vLeaderDraw,vLeaderNoDraw))))\n",
    "        \n",
    "        pl=(1-epsilon)*oldl + epsilon*plU\n",
    "        pf=(1-epsilon)*oldf + epsilon*pfU\n",
    "                \n",
    "    payoffF=pf*vFollowerDraw + (1-pf)*vFollowerNoDraw\n",
    "    payoffL=pl*vLeaderDraw + (1-pl)*vLeaderNoDraw\n",
    "    \n",
    "    return pl,pf,payoffL,payoffF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.0 1.0 1.0\n",
      "0.001 1.0 1.0\n",
      "0.002 1.0 1.0\n",
      "0.003 1.0 1.0\n",
      "0.004 1.0 1.0\n",
      "0.005 1.0 1.0\n",
      "0.006 1.0 1.0\n",
      "0.007 1.0 1.0\n",
      "0.008 1.0 1.0\n",
      "0.009000000000000001 1.0 1.0\n",
      "0.01 1.0 1.0\n",
      "0.011 1.0 1.0\n",
      "0.012 1.0 1.0\n",
      "0.013000000000000001 1.0 1.0\n",
      "0.014 1.0 1.0\n",
      "0.015 1.0 1.0\n",
      "0.016 1.0 1.0\n",
      "0.017 1.0 1.0\n",
      "0.018000000000000002 1.0 1.0\n",
      "0.019 1.0 1.0\n",
      "0.02 1.0 1.0\n",
      "0.021 1.0 1.0\n",
      "0.022 1.0 1.0\n",
      "0.023 1.0 1.0\n",
      "0.024 1.0 1.0\n",
      "0.025 1.0 1.0\n",
      "0.026000000000000002 1.0 1.0\n",
      "0.027 1.0 1.0\n",
      "0.028 1.0 1.0\n",
      "0.029 1.0 1.0\n",
      "0.03 1.0 1.0\n",
      "0.031 1.0 1.0\n",
      "0.032 1.0 1.0\n",
      "0.033 1.0 1.0\n",
      "0.034 1.0 1.0\n",
      "0.035 1.0 1.0\n",
      "0.036000000000000004 1.0 1.0\n",
      "0.037 1.0 1.0\n",
      "0.038 1.0 1.0\n",
      "0.039 1.0 1.0\n",
      "0.04 1.0 1.0\n",
      "0.041 1.0 1.0\n",
      "0.042 1.0 1.0\n",
      "0.043000000000000003 1.0 1.0\n",
      "0.044 1.0 1.0\n",
      "0.045 1.0 1.0\n",
      "0.046 1.0 1.0\n",
      "0.047 1.0 1.0\n",
      "0.048 1.0 1.0\n",
      "0.049 1.0 1.0\n",
      "0.05 1.0 1.0\n",
      "0.051000000000000004 1.0 1.0\n",
      "0.052000000000000005 1.0 1.0\n",
      "0.053 1.0 1.0\n",
      "0.054 1.0 1.0\n",
      "0.055 1.0 1.0\n",
      "0.056 1.0 1.0\n",
      "0.057 1.0 1.0\n",
      "0.058 1.0 1.0\n",
      "0.059000000000000004 1.0 1.0\n",
      "0.06 1.0 1.0\n",
      "0.061 1.0 1.0\n",
      "0.062 1.0 1.0\n",
      "0.063 1.0 1.0\n",
      "0.064 1.0 1.0\n",
      "0.065 1.0 1.0\n",
      "0.066 1.0 1.0\n",
      "0.067 1.0 1.0\n",
      "0.068 1.0 1.0\n",
      "0.069 1.0 1.0\n",
      "0.07 1.0 1.0\n",
      "0.07100000000000001 1.0 1.0\n",
      "0.07200000000000001 1.0 1.0\n",
      "0.073 1.0 1.0\n",
      "0.074 1.0 1.0\n",
      "0.075 1.0 1.0\n",
      "0.076 1.0 1.0\n",
      "0.077 1.0 1.0\n",
      "0.078 1.0 1.0\n",
      "0.079 1.0 1.0\n",
      "0.08 1.0 1.0\n",
      "0.081 1.0 1.0\n",
      "0.082 1.0 1.0\n",
      "0.083 1.0 1.0\n",
      "0.084 1.0 1.0\n",
      "0.085 1.0 1.0\n",
      "0.08600000000000001 1.0 1.0\n",
      "0.08700000000000001 1.0 1.0\n",
      "0.088 1.0 1.0\n",
      "0.089 1.0 1.0\n",
      "0.09 1.0 1.0\n",
      "0.091 1.0 1.0\n",
      "0.092 1.0 1.0\n",
      "0.093 1.0 1.0\n",
      "0.094 1.0 1.0\n",
      "0.095 1.0 1.0\n",
      "0.096 1.0 1.0\n",
      "0.097 1.0 1.0\n",
      "0.098 1.0 1.0\n",
      "0.099 1.0 1.0\n",
      "0.1 1.0 1.0\n",
      "0.101 1.0 1.0\n",
      "0.10200000000000001 1.0 1.0\n",
      "0.10300000000000001 1.0 1.0\n",
      "0.10400000000000001 1.0 1.0\n",
      "0.105 1.0 1.0\n",
      "0.106 1.0 1.0\n",
      "0.107 1.0 1.0\n",
      "0.108 1.0 1.0\n",
      "0.109 1.0 1.0\n",
      "0.11 1.0 1.0\n",
      "0.111 1.0 1.0\n",
      "0.112 1.0 1.0\n",
      "0.113 1.0 1.0\n",
      "0.114 1.0 1.0\n",
      "0.115 1.0 1.0\n",
      "0.116 1.0 1.0\n",
      "0.117 1.0 1.0\n",
      "0.11800000000000001 1.0 1.0\n",
      "0.11900000000000001 1.0 1.0\n",
      "0.12 1.0 1.0\n",
      "0.121 1.0 1.0\n",
      "0.122 1.0 1.0\n",
      "0.123 1.0 1.0\n",
      "0.124 1.0 1.0\n",
      "0.125 1.0 1.0\n",
      "0.126 1.0 1.0\n",
      "0.127 1.0 1.0\n",
      "0.128 1.0 1.0\n",
      "0.129 1.0 1.0\n",
      "0.13 1.0 1.0\n",
      "0.131 1.0 1.0\n",
      "0.132 1.0 1.0\n",
      "0.133 1.0 1.0\n",
      "0.134 1.0 1.0\n",
      "0.135 1.0 1.0\n",
      "0.136 1.0 1.0\n",
      "0.137 1.0 1.0\n",
      "0.138 1.0 1.0\n",
      "0.139 1.0 1.0\n",
      "0.14 1.0 1.0\n",
      "0.14100000000000001 1.0 1.0\n",
      "0.14200000000000002 1.0 1.0\n",
      "0.14300000000000002 1.0 1.0\n",
      "0.14400000000000002 1.0 1.0\n",
      "0.145 1.0 1.0\n",
      "0.146 1.0 1.0\n",
      "0.147 1.0 1.0\n",
      "0.148 1.0 1.0\n",
      "0.149 1.0 1.0\n",
      "0.15 1.0 1.0\n",
      "0.151 1.0 1.0\n",
      "0.152 1.0 1.0\n",
      "0.153 1.0 1.0\n",
      "0.154 1.0 1.0\n",
      "0.155 1.0 1.0\n",
      "0.156 1.0 1.0\n",
      "0.157 1.0 1.0\n",
      "0.158 1.0 1.0\n",
      "0.159 1.0 1.0\n",
      "0.16 1.0 1.0\n",
      "0.161 1.0 1.0\n",
      "0.162 1.0 1.0\n",
      "0.163 1.0 1.0\n",
      "0.164 1.0 1.0\n",
      "0.165 1.0 1.0\n",
      "0.166 1.0 1.0\n",
      "0.167 1.0 1.0\n",
      "0.168 1.0 1.0\n",
      "0.169 1.0 1.0\n",
      "0.17 1.0 1.0\n",
      "0.171 1.0 1.0\n",
      "0.17200000000000001 1.0 1.0\n",
      "0.17300000000000001 1.0 1.0\n",
      "0.17400000000000002 1.0 1.0\n",
      "0.17500000000000002 1.0 1.0\n",
      "0.176 1.0 1.0\n",
      "0.177 1.0 1.0\n",
      "0.178 1.0 1.0\n",
      "0.179 1.0 1.0\n",
      "0.18 1.0 1.0\n",
      "0.181 1.0 1.0\n",
      "0.182 1.0 1.0\n",
      "0.183 1.0 1.0\n",
      "0.184 1.0 1.0\n",
      "0.185 1.0 1.0\n",
      "0.186 1.0 1.0\n",
      "0.187 1.0 1.0\n",
      "0.188 1.0 1.0\n",
      "0.189 1.0 1.0\n",
      "0.19 1.0 1.0\n",
      "0.191 1.0 1.0\n",
      "0.192 1.0 1.0\n",
      "0.193 1.0 1.0\n",
      "0.194 1.0 1.0\n",
      "0.195 1.0 1.0\n",
      "0.196 1.0 1.0\n",
      "0.197 1.0 1.0\n",
      "0.198 1.0 1.0\n",
      "0.199 1.0 1.0\n",
      "0.2 1.0 1.0\n",
      "0.201 1.0 1.0\n",
      "0.202 1.0 1.0\n",
      "0.203 1.0 1.0\n",
      "0.20400000000000001 1.0 1.0\n",
      "0.20500000000000002 1.0 1.0\n",
      "0.20600000000000002 1.0 1.0\n",
      "0.20700000000000002 1.0 1.0\n",
      "0.20800000000000002 1.0 1.0\n",
      "0.209 1.0 1.0\n",
      "0.21 1.0 1.0\n",
      "0.211 1.0 1.0\n",
      "0.212 1.0 1.0\n",
      "0.213 1.0 1.0\n",
      "0.214 1.0 1.0\n",
      "0.215 1.0 1.0\n",
      "0.216 1.0 1.0\n",
      "0.217 1.0 1.0\n",
      "0.218 1.0 1.0\n",
      "0.219 1.0 1.0\n",
      "0.22 1.0 1.0\n",
      "0.221 1.0 1.0\n",
      "0.222 1.0 1.0\n",
      "0.223 1.0 1.0\n",
      "0.224 1.0 1.0\n",
      "0.225 1.0 1.0\n",
      "0.226 1.0 1.0\n",
      "0.227 1.0 1.0\n",
      "0.228 1.0 1.0\n",
      "0.229 1.0 1.0\n",
      "0.23 1.0 1.0\n",
      "0.231 1.0 1.0\n",
      "0.232 1.0 1.0\n",
      "0.233 1.0 1.0\n",
      "0.234 1.0 1.0\n",
      "0.23500000000000001 1.0 1.0\n",
      "0.23600000000000002 1.0 1.0\n",
      "0.23700000000000002 1.0 1.0\n",
      "0.23800000000000002 1.0 1.0\n",
      "0.23900000000000002 1.0 1.0\n",
      "0.24 1.0 1.0\n",
      "0.241 1.0 1.0\n",
      "0.242 1.0 1.0\n",
      "0.243 1.0 1.0\n",
      "0.244 1.0 1.0\n",
      "0.245 1.0 1.0\n",
      "0.246 1.0 1.0\n",
      "0.247 1.0 1.0\n",
      "0.248 1.0 1.0\n",
      "0.249 1.0 1.0\n",
      "0.25 1.0 1.0\n",
      "0.251 1.0 1.0\n",
      "0.252 1.0 1.0\n",
      "0.253 1.0 1.0\n",
      "0.254 1.0 1.0\n",
      "0.255 1.0 1.0\n",
      "0.256 1.0 1.0\n",
      "0.257 1.0 1.0\n",
      "0.258 1.0 1.0\n",
      "0.259 1.0 1.0\n",
      "0.26 1.0 1.0\n",
      "0.261 1.0 1.0\n",
      "0.262 1.0 1.0\n",
      "0.263 1.0 1.0\n",
      "0.264 1.0 1.0\n",
      "0.265 1.0 1.0\n",
      "0.266 1.0 1.0\n",
      "0.267 1.0 1.0\n",
      "0.268 1.0 1.0\n",
      "0.269 1.0 1.0\n",
      "0.27 1.0 1.0\n",
      "0.271 1.0 1.0\n",
      "0.272 1.0 1.0\n",
      "0.273 1.0 1.0\n",
      "0.274 1.0 1.0\n",
      "0.275 1.0 1.0\n",
      "0.276 1.0 1.0\n",
      "0.277 1.0 1.0\n",
      "0.278 1.0 1.0\n",
      "0.279 1.0 1.0\n",
      "0.28 1.0 1.0\n",
      "0.281 1.0 1.0\n",
      "0.28200000000000003 1.0 1.0\n",
      "0.28300000000000003 1.0 1.0\n",
      "0.28400000000000003 1.0 1.0\n",
      "0.28500000000000003 1.0 1.0\n",
      "0.28600000000000003 1.0 1.0\n",
      "0.28700000000000003 1.0 1.0\n",
      "0.28800000000000003 1.0 1.0\n",
      "0.289 1.0 1.0\n",
      "0.29 1.0 1.0\n",
      "0.291 1.0 1.0\n",
      "0.292 1.0 1.0\n",
      "0.293 1.0 1.0\n",
      "0.294 1.0 1.0\n",
      "0.295 1.0 1.0\n",
      "0.296 1.0 1.0\n",
      "0.297 1.0 1.0\n",
      "0.298 1.0 1.0\n",
      "0.299 1.0 1.0\n",
      "0.3 1.0 1.0\n",
      "0.301 1.0 1.0\n",
      "0.302 1.0 1.0\n",
      "0.303 1.0 1.0\n",
      "0.304 1.0 1.0\n",
      "0.305 1.0 1.0\n",
      "0.306 1.0 1.0\n",
      "0.307 1.0 1.0\n",
      "0.308 1.0 1.0\n",
      "0.309 1.0 1.0\n",
      "0.31 1.0 1.0\n",
      "0.311 1.0 1.0\n",
      "0.312 1.0 1.0\n",
      "0.313 1.0 1.0\n",
      "0.314 1.0 1.0\n",
      "0.315 1.0 1.0\n",
      "0.316 1.0 1.0\n",
      "0.317 1.0 1.0\n",
      "0.318 1.0 1.0\n",
      "0.319 1.0 1.0\n",
      "0.32 1.0 1.0\n",
      "0.321 1.0 1.0\n",
      "0.322 1.0 1.0\n",
      "0.323 1.0 1.0\n",
      "0.324 1.0 1.0\n",
      "0.325 1.0 1.0\n",
      "0.326 1.0 1.0\n",
      "0.327 1.0 1.0\n",
      "0.328 1.0 1.0\n",
      "0.329 1.0 1.0\n",
      "0.33 1.0 1.0\n",
      "0.331 1.0 1.0\n",
      "0.332 1.0 1.0\n",
      "0.333 1.0 1.0\n",
      "0.334 1.0 1.0\n",
      "0.335 1.0 1.0\n",
      "0.336 1.0 1.0\n",
      "0.337 1.0 1.0\n",
      "0.338 1.0 1.0\n",
      "0.339 1.0 1.0\n",
      "0.34 1.0 1.0\n",
      "0.341 1.0 1.0\n",
      "0.342 1.0 1.0\n",
      "0.343 1.0 1.0\n",
      "0.34400000000000003 1.0 1.0\n",
      "0.34500000000000003 1.0 1.0\n",
      "0.34600000000000003 1.0 1.0\n",
      "0.34700000000000003 1.0 1.0\n",
      "0.34800000000000003 1.0 1.0\n",
      "0.34900000000000003 1.0 1.0\n",
      "0.35000000000000003 1.0 1.0\n",
      "0.35100000000000003 1.0 1.0\n",
      "0.352 1.0 1.0\n",
      "0.353 1.0 1.0\n",
      "0.354 1.0 1.0\n",
      "0.355 1.0 1.0\n",
      "0.356 1.0 1.0\n",
      "0.357 1.0 1.0\n",
      "0.358 1.0 1.0\n",
      "0.359 1.0 1.0\n",
      "0.36 1.0 1.0\n",
      "0.361 1.0 1.0\n",
      "0.362 1.0 1.0\n",
      "0.363 1.0 1.0\n",
      "0.364 1.0 1.0\n",
      "0.365 1.0 1.0\n",
      "0.366 1.0 1.0\n",
      "0.367 1.0 1.0\n",
      "0.368 1.0 1.0\n",
      "0.369 1.0 1.0\n",
      "0.37 1.0 1.0\n",
      "0.371 1.0 1.0\n",
      "0.372 1.0 1.0\n",
      "0.373 1.0 1.0\n",
      "0.374 1.0 1.0\n",
      "0.375 1.0 1.0\n",
      "0.376 1.0 1.0\n",
      "0.377 1.0 1.0\n",
      "0.378 1.0 1.0\n",
      "0.379 1.0 1.0\n",
      "0.38 1.0 1.0\n",
      "0.381 1.0 1.0\n",
      "0.382 1.0 1.0\n",
      "0.383 1.0 1.0\n",
      "0.384 1.0 1.0\n",
      "0.385 1.0 1.0\n",
      "0.386 1.0 1.0\n",
      "0.387 1.0 1.0\n",
      "0.388 1.0 1.0\n",
      "0.389 1.0 1.0\n",
      "0.39 1.0 1.0\n",
      "0.391 1.0 1.0\n",
      "0.392 1.0 1.0\n",
      "0.393 1.0 1.0\n",
      "0.394 1.0 1.0\n",
      "0.395 1.0 1.0\n",
      "0.396 1.0 1.0\n",
      "0.397 1.0 1.0\n",
      "0.398 1.0 1.0\n",
      "0.399 1.0 1.0\n",
      "0.4 1.0 1.0\n",
      "0.401 1.0 1.0\n",
      "0.402 1.0 1.0\n",
      "0.403 1.0 1.0\n",
      "0.404 1.0 1.0\n",
      "0.405 1.0 1.0\n",
      "0.406 1.0 1.0\n",
      "0.40700000000000003 1.0 1.0\n",
      "0.40800000000000003 1.0 1.0\n",
      "0.40900000000000003 1.0 1.0\n",
      "0.41000000000000003 1.0 1.0\n",
      "0.41100000000000003 1.0 1.0\n",
      "0.41200000000000003 1.0 1.0\n",
      "0.41300000000000003 1.0 1.0\n",
      "0.41400000000000003 1.0 1.0\n",
      "0.41500000000000004 1.0 1.0\n",
      "0.41600000000000004 1.0 1.0\n",
      "0.417 1.0 1.0\n",
      "0.418 1.0 1.0\n",
      "0.419 1.0 1.0\n",
      "0.42 1.0 1.0\n",
      "0.421 1.0 1.0\n",
      "0.422 1.0 1.0\n",
      "0.423 1.0 1.0\n",
      "0.424 1.0 1.0\n",
      "0.425 1.0 1.0\n",
      "0.426 1.0 1.0\n",
      "0.427 1.0 1.0\n",
      "0.428 1.0 1.0\n",
      "0.429 1.0 1.0\n",
      "0.43 1.0 1.0\n",
      "0.431 1.0 1.0\n",
      "0.432 1.0 1.0\n",
      "0.433 1.0 1.0\n",
      "0.434 1.0 1.0\n",
      "0.435 1.0 1.0\n",
      "0.436 1.0 1.0\n",
      "0.437 1.0 1.0\n",
      "0.438 1.0 1.0\n",
      "0.439 1.0 1.0\n",
      "0.44 1.0 1.0\n",
      "0.441 1.0 1.0\n",
      "0.442 1.0 1.0\n",
      "0.443 1.0 1.0\n",
      "0.444 1.0 1.0\n",
      "0.445 1.0 1.0\n",
      "0.446 1.0 1.0\n",
      "0.447 1.0 1.0\n",
      "0.448 1.0 1.0\n",
      "0.449 1.0 1.0\n",
      "0.45 1.0 1.0\n",
      "0.451 1.0 1.0\n",
      "0.452 1.0 1.0\n",
      "0.453 1.0 1.0\n",
      "0.454 1.0 1.0\n",
      "0.455 1.0 1.0\n",
      "0.456 1.0 1.0\n",
      "0.457 1.0 1.0\n",
      "0.458 1.0 1.0\n",
      "0.459 1.0 1.0\n",
      "0.46 1.0 1.0\n",
      "0.461 1.0 1.0\n",
      "0.462 1.0 1.0\n",
      "0.463 1.0 1.0\n",
      "0.464 1.0 1.0\n",
      "0.465 1.0 1.0\n",
      "0.466 1.0 1.0\n",
      "0.467 1.0 1.0\n",
      "0.468 1.0 1.0\n",
      "0.46900000000000003 1.0 1.0\n",
      "0.47000000000000003 1.0 1.0\n",
      "0.47100000000000003 1.0 1.0\n",
      "0.47200000000000003 1.0 1.0\n",
      "0.47300000000000003 1.0 1.0\n",
      "0.47400000000000003 1.0 1.0\n",
      "0.47500000000000003 1.0 1.0\n",
      "0.47600000000000003 1.0 1.0\n",
      "0.47700000000000004 1.0 1.0\n",
      "0.47800000000000004 1.0 1.0\n",
      "0.47900000000000004 1.0 1.0\n",
      "0.48 1.0 1.0\n",
      "0.481 1.0 1.0\n",
      "0.482 1.0 1.0\n",
      "0.483 1.0 1.0\n",
      "0.484 1.0 1.0\n",
      "0.485 1.0 1.0\n",
      "0.486 1.0 1.0\n",
      "0.487 1.0 1.0\n",
      "0.488 1.0 1.0\n",
      "0.489 1.0 1.0\n",
      "0.49 1.0 1.0\n",
      "0.491 1.0 1.0\n",
      "0.492 1.0 1.0\n",
      "0.493 1.0 1.0\n",
      "0.494 1.0 1.0\n",
      "0.495 1.0 1.0\n",
      "0.496 1.0 1.0\n",
      "0.497 1.0 1.0\n",
      "0.498 1.0 1.0\n",
      "0.499 1.0 1.0\n",
      "0.5 1.0 1.0\n",
      "0.501 1.0 1.0\n",
      "0.502 1.0 1.0\n",
      "0.503 1.0 1.0\n",
      "0.504 1.0 1.0\n",
      "0.505 1.0 1.0\n",
      "0.506 1.0 1.0\n",
      "0.507 1.0 1.0\n",
      "0.508 1.0 1.0\n",
      "0.509 1.0 1.0\n",
      "0.51 1.0 1.0\n",
      "0.511 1.0 1.0\n",
      "0.512 1.0 1.0\n",
      "0.513 1.0 1.0\n",
      "0.514 1.0 1.0\n",
      "0.515 1.0 1.0\n",
      "0.516 1.0 1.0\n",
      "0.517 1.0 1.0\n",
      "0.518 1.0 1.0\n",
      "0.519 1.0 1.0\n",
      "0.52 1.0 1.0\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.521 1.0 1.0\n",
      "0.522 1.0 1.0\n",
      "0.523 1.0 1.0\n",
      "0.524 1.0 1.0\n",
      "0.525 1.0 1.0\n",
      "0.526 1.0 1.0\n",
      "0.527 1.0 1.0\n",
      "0.528 1.0 1.0\n",
      "0.529 1.0 1.0\n",
      "0.53 1.0 1.0\n",
      "0.531 1.0 1.0\n",
      "0.532 1.0 1.0\n",
      "0.533 1.0 1.0\n",
      "0.534 1.0 1.0\n",
      "0.535 1.0 1.0\n",
      "0.536 1.0 1.0\n",
      "0.537 1.0 1.0\n",
      "0.538 1.0 1.0\n",
      "0.539 1.0 1.0\n",
      "0.54 1.0 1.0\n",
      "0.541 1.0 1.0\n",
      "0.542 1.0 1.0\n",
      "0.543 1.0 1.0\n",
      "0.544 1.0 1.0\n",
      "0.545 0.9999999999999993 1.0\n",
      "0.546 0.9999999999999389 1.0\n",
      "0.547 0.9999999999944365 1.0\n",
      "0.548 0.9999999994979896 1.0\n",
      "0.549 0.9999999551514709 1.0\n",
      "0.55 0.999996033014085 1.0\n",
      "0.551 0.9996527002645881 1.0\n",
      "0.552 0.9707559794195245 1.0\n",
      "0.553 0.2788395749107977 1.0\n",
      "0.554 0.004528165228184282 1.0\n",
      "0.555 5.404578246123192e-05 1.0\n",
      "0.556 6.486317785732611e-07 1.0\n",
      "0.557 7.861998443993274e-09 1.0\n",
      "0.558 9.624731876879742e-11 1.0\n",
      "0.559 1.1900509435662432e-12 1.0\n",
      "0.56 1.4861535943888195e-14 1.0\n",
      "0.561 1.8744897478461228e-16 1.0\n",
      "0.562 2.3879414430458577e-18 1.0\n",
      "0.5630000000000001 3.072454826660257e-20 1.0\n",
      "0.5640000000000001 3.992717376628713e-22 1.0\n",
      "0.5650000000000001 5.240501667681043e-24 1.0\n",
      "0.5660000000000001 6.947017410135142e-26 1.0\n",
      "0.5670000000000001 9.301331889526904e-28 1.0\n",
      "0.5680000000000001 1.2578044446954383e-29 1.0\n",
      "0.5690000000000001 1.717917639770908e-31 1.0\n",
      "0.5700000000000001 2.3698059373096212e-33 1.0\n",
      "0.5710000000000001 3.301752059794418e-35 1.0\n",
      "0.5720000000000001 4.646194236740053e-37 1.0\n",
      "0.5730000000000001 6.603459159236021e-39 1.0\n",
      "0.5740000000000001 9.479094669945547e-41 1.0\n",
      "0.5750000000000001 1.3743060402961459e-42 1.0\n",
      "0.5760000000000001 2.0124323035097908e-44 1.0\n",
      "0.577 2.9763248801411243e-46 1.0\n",
      "0.578 4.4459095166972084e-48 1.0\n",
      "0.579 6.707522445914879e-50 1.0\n",
      "0.58 1.0220799755645528e-51 1.0\n",
      "0.581 1.5730004791481208e-53 1.0\n",
      "0.582 2.445085556316842e-55 1.0\n",
      "0.583 3.83866749803642e-57 1.0\n",
      "0.584 6.08678779345314e-59 1.0\n",
      "0.585 9.74803447750185e-61 1.0\n",
      "0.586 1.5767657661127162e-62 1.0\n",
      "0.587 2.5759565777054328e-64 1.0\n",
      "0.588 4.2504129274058104e-66 1.0\n",
      "0.589 7.083451745650508e-68 1.0\n",
      "0.59 1.1922847407557022e-69 1.0\n",
      "0.591 2.026918384704098e-71 1.0\n",
      "0.592 3.480276652824363e-73 1.0\n",
      "0.593 6.035489579085497e-75 1.0\n",
      "0.594 1.0571399144764886e-76 1.0\n",
      "0.595 1.8701380534884658e-78 1.0\n",
      "0.596 3.3414586710966977e-80 1.0\n",
      "0.597 6.030033857176279e-82 1.0\n",
      "0.598 1.0990681874648663e-83 1.0\n",
      "0.599 2.0232556147294438e-85 1.0\n",
      "0.6 3.7618207810954193e-87 1.0\n",
      "0.601 7.06426005300877e-89 1.0\n",
      "0.602 1.3398509406640029e-90 1.0\n",
      "0.603 2.5666551558623906e-92 1.0\n",
      "0.604 4.965920814552118e-94 1.0\n",
      "0.605 9.704055854313801e-96 1.0\n",
      "0.606 1.9152612195838607e-97 1.0\n",
      "0.607 3.817894934311455e-99 1.0\n",
      "0.608 7.686721751247158e-101 1.0\n",
      "0.609 1.563074141027434e-102 1.0\n",
      "0.61 3.2102527468576665e-104 1.0\n",
      "0.611 6.659170034680092e-106 1.0\n",
      "0.612 1.3951542049711614e-107 1.0\n",
      "0.613 2.952198468488837e-109 1.0\n",
      "0.614 6.309429890670989e-111 1.0\n",
      "0.615 1.3619335463794743e-112 1.0\n",
      "0.616 2.96922388748855e-114 1.0\n",
      "0.617 6.53809466443282e-116 1.0\n",
      "0.618 1.4540545277564487e-117 1.0\n",
      "0.619 3.266114546322737e-119 1.0\n",
      "0.62 7.409746678452503e-121 1.0\n",
      "0.621 1.697839134659619e-122 1.0\n",
      "0.622 3.92926164351271e-124 1.0\n",
      "0.623 9.18431113781062e-126 1.0\n",
      "0.624 2.168220554630569e-127 1.0\n",
      "0.625 5.169893021975556e-129 1.0\n",
      "0.626 1.2450330667787438e-130 1.0\n",
      "0.627 3.028317773901774e-132 1.0\n",
      "0.628 7.439491213331949e-134 1.0\n",
      "0.629 1.845891861008675e-135 1.0\n",
      "0.63 4.625838908719328e-137 1.0\n",
      "0.631 1.1708357770828232e-138 1.0\n",
      "0.632 2.9931101153821795e-140 1.0\n",
      "0.633 7.728062660766434e-142 1.0\n",
      "0.634 2.0153004644409902e-143 1.0\n",
      "0.635 5.3079913355868604e-145 1.0\n",
      "0.636 1.412023210731504e-146 1.0\n",
      "0.637 3.793802305901748e-148 1.0\n",
      "0.638 1.0295057740985955e-149 1.0\n",
      "0.639 2.821656269363048e-151 1.0\n",
      "0.64 7.81089245467862e-153 1.0\n",
      "0.641 2.183828045599031e-154 1.0\n",
      "0.642 6.166765726671788e-156 1.0\n",
      "0.643 1.7588049980622092e-157 1.0\n",
      "0.644 5.066396351352681e-159 1.0\n",
      "0.645 1.474014865777352e-160 1.0\n",
      "0.646 4.331375092979898e-162 1.0\n",
      "0.647 1.2854966709514145e-163 1.0\n",
      "0.648 3.853340151585572e-165 1.0\n",
      "0.649 1.1666080515202443e-166 1.0\n",
      "0.65 3.567252255112559e-168 1.0\n",
      "0.651 1.1017014042603844e-169 1.0\n",
      "0.652 3.436491032127129e-171 1.0\n",
      "0.653 1.0826491940228164e-172 1.0\n",
      "0.654 3.444938943078273e-174 1.0\n",
      "0.655 1.1071246776161375e-175 1.0\n",
      "0.656 3.593625063234796e-177 1.0\n",
      "0.657 1.1781218912696827e-178 1.0\n",
      "0.658 3.900936837096356e-180 1.0\n",
      "0.659 1.304574366874273e-181 1.0\n",
      "0.66 4.406461638733827e-183 1.0\n",
      "0.661 1.5032540286670063e-184 1.0\n",
      "0.662 5.1795972220741765e-186 1.0\n",
      "0.663 1.8025230716212447e-187 1.0\n",
      "0.664 6.3355876751676284e-189 1.0\n",
      "0.665 2.2491281874122166e-190 1.0\n",
      "0.666 8.064226952602967e-192 1.0\n",
      "0.667 2.920333867272485e-193 1.0\n",
      "0.668 1.0681284884562206e-194 1.0\n",
      "0.669 3.945805937464945e-196 1.0\n",
      "0.67 1.4722080075895423e-197 1.0\n",
      "0.671 5.547839128981097e-199 1.0\n",
      "0.672 2.111542237637491e-200 1.0\n",
      "0.673 8.1170256255518535e-202 1.0\n",
      "0.674 3.151485338688138e-203 1.0\n",
      "0.675 1.235819077365786e-204 1.0\n",
      "0.676 4.894583359201806e-206 1.0\n",
      "0.677 1.9579328528327174e-207 1.0\n",
      "0.678 7.910448145643639e-209 1.0\n",
      "0.679 3.227941181023231e-210 1.0\n",
      "0.68 1.3303667042917687e-211 1.0\n",
      "0.681 5.5378138320874524e-213 1.0\n",
      "0.682 2.3282336750819667e-214 1.0\n",
      "0.683 9.88635068072033e-216 1.0\n",
      "0.684 4.240008100374242e-217 1.0\n",
      "0.685 1.836616963841517e-218 1.0\n",
      "0.686 8.035108147816438e-220 1.0\n",
      "0.687 3.55047199746987e-221 1.0\n",
      "0.6880000000000001 1.5845344545813025e-222 1.0\n",
      "0.6890000000000001 7.142306980426083e-224 1.0\n",
      "0.6900000000000001 3.2515959054909414e-225 1.0\n",
      "0.6910000000000001 1.4951193204313588e-226 1.0\n",
      "0.6920000000000001 6.943466896836906e-228 1.0\n",
      "0.6930000000000001 3.2568526870755973e-229 1.0\n",
      "0.6940000000000001 1.5429117664517782e-230 1.0\n",
      "0.6950000000000001 7.382531301742092e-232 1.0\n",
      "0.6960000000000001 3.56771975493316e-233 1.0\n",
      "0.6970000000000001 1.741395425685988e-234 1.0\n",
      "0.6980000000000001 8.584703412653706e-236 1.0\n",
      "0.6990000000000001 4.2743927246712773e-237 1.0\n",
      "0.7000000000000001 2.1495362744703992e-238 1.0\n",
      "0.7010000000000001 1.091783093838624e-239 1.0\n",
      "0.7020000000000001 5.6007886129368965e-241 1.0\n",
      "0.7030000000000001 2.9019052515255612e-242 1.0\n",
      "0.704 1.51858290029158e-243 1.0\n",
      "0.705 8.02629304822774e-245 1.0\n",
      "0.706 4.2846243268920923e-246 1.0\n",
      "0.707 2.310104980326873e-247 1.0\n",
      "0.708 1.2579747197927537e-248 1.0\n",
      "0.709 6.918840850948682e-250 1.0\n",
      "0.71 3.8434036511924095e-251 1.0\n",
      "0.711 2.1563531417304021e-252 1.0\n",
      "0.712 1.2219262749864907e-253 1.0\n",
      "0.713 6.993448019220672e-255 1.0\n",
      "0.714 4.0425828478692584e-256 1.0\n",
      "0.715 2.360194189809514e-257 1.0\n",
      "0.716 1.3917389278126388e-258 1.0\n",
      "0.717 8.288750039375426e-260 1.0\n",
      "0.718 4.985876779235887e-261 1.0\n",
      "0.719 3.029111567383757e-262 1.0\n",
      "0.72 1.8587039753958063e-263 1.0\n",
      "0.721 1.151930868427767e-264 1.0\n",
      "0.722 7.210474326313155e-266 1.0\n",
      "0.723 4.558505503789471e-267 1.0\n",
      "0.724 2.910732950240623e-268 1.0\n",
      "0.725 1.8771694215244473e-269 1.0\n",
      "0.726 1.2227166046538878e-270 1.0\n",
      "0.727 8.04395030809807e-272 1.0\n",
      "0.728 5.3448334678840525e-273 1.0\n",
      "0.729 3.586907750066228e-274 1.0\n",
      "0.73 2.4312379531294536e-275 1.0\n",
      "0.731 1.6643932895361132e-276 1.0\n",
      "0.732 1.1508154284812411e-277 1.0\n",
      "0.733 8.036679057718769e-279 1.0\n",
      "0.734 5.668508535960642e-280 1.0\n",
      "0.735 4.038147839684222e-281 1.0\n",
      "0.736 2.905473071335533e-282 1.0\n",
      "0.737 2.111410731727104e-283 1.0\n",
      "0.738 1.5497078205767718e-284 1.0\n",
      "0.739 1.14880986133049e-285 1.0\n",
      "0.74 8.6013716892446e-287 1.0\n",
      "0.741 6.5044189363933715e-288 1.0\n",
      "0.742 4.967873469870022e-289 1.0\n",
      "0.743 3.832249502611491e-290 1.0\n",
      "0.744 2.9857831112604695e-291 1.0\n",
      "0.745 2.3495460851907475e-292 1.0\n",
      "0.746 1.8673722846076385e-293 1.0\n",
      "0.747 1.4989911875988159e-294 1.0\n",
      "0.748 1.2153139436408947e-295 1.0\n",
      "0.749 9.951742079687764e-297 1.0\n",
      "0.75 8.230590091880324e-298 1.0\n",
      "0.751 6.875179863815831e-299 1.0\n",
      "0.752 5.800405902039431e-300 1.0\n",
      "0.753 4.942582615293982e-301 1.0\n",
      "0.754 4.2537378230994797e-302 1.0\n",
      "0.755 3.697504664744781e-303 1.0\n",
      "0.756 3.2461454276193244e-304 1.0\n",
      "0.757 2.8783820934437006e-305 1.0\n",
      "0.758 2.5778055015191593e-306 1.0\n",
      "0.759 2.3317021775773496e-307 1.0\n",
      "0.76 2.130184599006685e-308 1.0\n",
      "0.761 1.965543377647983e-309 1.0\n",
      "0.762 1.8317628847511e-310 1.0\n",
      "0.763 1.724158182372e-311 1.0\n",
      "0.764 1.639102792093e-312 1.0\n",
      "0.765 1.57382522825e-313 1.0\n",
      "0.766 1.5262583235e-314 1.0\n",
      "0.767 1.494929864e-315 1.0\n",
      "0.768 1.4788864e-316 1.0\n",
      "0.769 1.4776446e-317 1.0\n",
      "0.77 1.49117e-318 1.0\n",
      "0.771 1.51984e-319 1.0\n",
      "0.772 1.5647e-320 1.0\n",
      "0.773 1.625e-321 1.0\n",
      "0.774 1.73e-322 1.0\n",
      "0.775 2e-323 1.0\n",
      "0.776 0.0 1.0\n",
      "0.777 0.0 1.0\n",
      "0.778 0.0 1.0\n",
      "0.779 0.0 1.0\n",
      "0.78 0.0 1.0\n",
      "0.781 0.0 1.0\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.782 0.0 1.0\n",
      "0.783 0.0 1.0\n",
      "0.784 0.0 1.0\n",
      "0.785 0.0 1.0\n",
      "0.786 0.0 1.0\n",
      "0.787 0.0 1.0\n",
      "0.788 0.0 1.0\n",
      "0.789 0.0 1.0\n",
      "0.79 0.0 1.0\n",
      "0.791 0.0 1.0\n",
      "0.792 0.0 1.0\n",
      "0.793 0.0 1.0\n",
      "0.794 0.0 1.0\n",
      "0.795 0.0 1.0\n",
      "0.796 0.0 1.0\n",
      "0.797 0.0 1.0\n",
      "0.798 0.0 1.0\n",
      "0.799 0.0 1.0\n",
      "0.8 0.0 1.0\n",
      "0.801 0.0 1.0\n",
      "0.802 0.0 1.0\n",
      "0.803 0.0 1.0\n",
      "0.804 0.0 1.0\n",
      "0.805 0.0 1.0\n",
      "0.806 0.0 1.0\n",
      "0.807 0.0 1.0\n",
      "0.808 0.0 1.0\n",
      "0.809 0.0 1.0\n",
      "0.81 0.0 1.0\n",
      "0.811 0.0 1.0\n",
      "0.812 0.0 1.0\n",
      "0.8130000000000001 0.0 1.0\n",
      "0.8140000000000001 0.0 1.0\n",
      "0.8150000000000001 0.0 1.0\n",
      "0.8160000000000001 0.0 1.0\n",
      "0.8170000000000001 0.0 1.0\n",
      "0.8180000000000001 0.0 1.0\n",
      "0.8190000000000001 0.0 1.0\n",
      "0.8200000000000001 0.0 1.0\n",
      "0.8210000000000001 0.0 1.0\n",
      "0.8220000000000001 0.0 1.0\n",
      "0.8230000000000001 0.0 1.0\n",
      "0.8240000000000001 0.0 1.0\n",
      "0.8250000000000001 0.0 1.0\n",
      "0.8260000000000001 0.0 1.0\n",
      "0.8270000000000001 0.0 1.0\n",
      "0.8280000000000001 0.0 1.0\n",
      "0.8290000000000001 0.0 1.0\n",
      "0.8300000000000001 0.0 1.0\n",
      "0.8310000000000001 0.0 1.0\n",
      "0.8320000000000001 0.0 1.0\n",
      "0.833 0.0 1.0\n",
      "0.834 0.0 1.0\n",
      "0.835 0.0 1.0\n",
      "0.836 0.0 1.0\n",
      "0.837 0.0 1.0\n",
      "0.838 0.0 1.0\n",
      "0.839 0.0 1.0\n",
      "0.84 0.0 1.0\n",
      "0.841 0.0 1.0\n",
      "0.842 0.0 1.0\n",
      "0.843 0.0 1.0\n",
      "0.844 0.0 1.0\n",
      "0.845 0.0 1.0\n",
      "0.846 0.0 1.0\n",
      "0.847 0.0 1.0\n",
      "0.848 0.0 1.0\n",
      "0.849 0.0 1.0\n",
      "0.85 0.0 1.0\n",
      "0.851 0.0 1.0\n",
      "0.852 0.0 1.0\n",
      "0.853 0.0 1.0\n",
      "0.854 0.0 1.0\n",
      "0.855 0.0 1.0\n",
      "0.856 0.0 1.0\n",
      "0.857 0.0 1.0\n",
      "0.858 0.0 1.0\n",
      "0.859 0.0 1.0\n",
      "0.86 0.0 1.0\n",
      "0.861 0.0 1.0\n",
      "0.862 0.0 1.0\n",
      "0.863 0.0 1.0\n",
      "0.864 0.0 1.0\n",
      "0.865 0.0 1.0\n",
      "0.866 0.0 1.0\n",
      "0.867 0.0 1.0\n",
      "0.868 0.0 1.0\n",
      "0.869 0.0 1.0\n",
      "0.87 0.0 1.0\n",
      "0.871 0.0 1.0\n",
      "0.872 0.0 1.0\n",
      "0.873 0.0 1.0\n",
      "0.874 0.0 1.0\n",
      "0.875 0.0 1.0\n",
      "0.876 0.0 1.0\n",
      "0.877 0.0 1.0\n",
      "0.878 0.0 1.0\n",
      "0.879 0.0 1.0\n",
      "0.88 0.0 1.0\n",
      "0.881 0.0 1.0\n",
      "0.882 0.0 1.0\n",
      "0.883 0.0 1.0\n",
      "0.884 0.0 1.0\n",
      "0.885 0.0 1.0\n",
      "0.886 0.0 1.0\n",
      "0.887 0.0 1.0\n",
      "0.888 0.0 1.0\n",
      "0.889 0.0 1.0\n",
      "0.89 0.0 1.0\n",
      "0.891 0.0 1.0\n",
      "0.892 0.0 1.0\n",
      "0.893 0.0 1.0\n",
      "0.894 0.0 1.0\n",
      "0.895 0.0 1.0\n",
      "0.896 0.0 1.0\n",
      "0.897 0.0 0.9999999999998912\n",
      "0.898 0.0 0.999999997722073\n",
      "0.899 0.0 0.9999522746438816\n",
      "0.9 0.0 0.49999999999994477\n",
      "0.901 0.0 4.772535611846462e-05\n",
      "0.902 0.0 2.277927036015869e-09\n",
      "0.903 0.0 1.087200679573535e-13\n",
      "0.904 0.0 5.188951605053328e-18\n",
      "0.905 0.0 2.4765638272176363e-22\n",
      "0.906 0.0 1.1820053176656738e-26\n",
      "0.907 0.0 5.64143171128996e-31\n",
      "0.908 0.0 2.6925218759591253e-35\n",
      "0.909 0.0 1.28507698462608e-39\n",
      "0.91 0.0 6.133368390284175e-44\n",
      "0.911 0.0 2.927311613310344e-48\n",
      "0.912 0.0 1.3971365709902282e-52\n",
      "0.913 0.0 6.668202281994011e-57\n",
      "0.914 0.0 3.18257517531552e-61\n",
      "0.915 0.0 1.518967829438141e-65\n",
      "0.916 0.0 7.249674052520096e-70\n",
      "0.917 0.0 3.4600978933980464e-74\n",
      "0.918 0.0 1.6514228564159867e-78\n",
      "0.919 0.0 7.881850556589093e-83\n",
      "0.92 0.0 3.761820781094564e-87\n",
      "0.921 0.0 1.7954280517593261e-91\n",
      "0.922 0.0 8.569153281423557e-96\n",
      "0.923 0.0 4.0898541096412165e-100\n",
      "0.924 0.0 1.9519905979987767e-104\n",
      "0.925 0.0 9.316389270936312e-109\n",
      "0.926 0.0 4.446492167360024e-113\n",
      "0.927 0.0 2.1222055046661868e-117\n",
      "0.928 0.0 1.0128784746536918e-121\n",
      "0.929 0.0 4.834229306073826e-126\n",
      "0.93 0.0 2.3072632668684114e-130\n",
      "0.931 0.0 1.1012021659692653e-134\n",
      "0.932 0.0 5.2557773867795104e-139\n",
      "0.933 0.0 2.5084581916952254e-143\n",
      "0.934 0.0 1.1972277431900322e-147\n",
      "0.935 0.0 5.7140847465958015e-152\n",
      "0.936 0.0 2.7271974506937567e-156\n",
      "0.937 0.0 1.3016268160009255e-160\n",
      "0.9380000000000001 0.0 6.212356819641792e-165\n",
      "0.9390000000000001 0.0 2.9650109217264503e-169\n",
      "0.9400000000000001 0.0 1.4151295589078134e-173\n",
      "0.9410000000000001 0.0 6.754078556070088e-178\n",
      "0.9420000000000001 0.0 3.2235618890450226e-182\n",
      "0.9430000000000001 0.0 1.5385298181296831e-186\n",
      "0.9440000000000001 0.0 7.343038796054464e-191\n",
      "0.9450000000000001 0.0 3.504658676418262e-195\n",
      "0.9460000000000001 0.0 1.672690663815295e-199\n",
      "0.9470000000000001 0.0 7.9833567692079e-204\n",
      "0.9480000000000001 0.0 3.8102672946764873e-208\n",
      "0.9490000000000001 0.0 1.818550426416901e-212\n",
      "0.9500000000000001 0.0 8.679510904763695e-217\n",
      "0.9510000000000001 0.0 4.1425251921304693e-221\n",
      "0.9520000000000001 0.0 1.977129259439854e-225\n",
      "0.9530000000000001 0.0 9.436370154028135e-230\n",
      "0.9540000000000001 0.0 4.503756204035977e-234\n",
      "0.9550000000000001 0.0 2.149536274468444e-238\n",
      "0.9560000000000001 0.0 1.0259228044170225e-242\n",
      "0.9570000000000001 0.0 4.8964868056630664e-247\n",
      "0.9580000000000001 0.0 2.3369772983708344e-251\n",
      "0.9590000000000001 0.0 1.1153839701525446e-255\n",
      "0.96 0.0 5.323463782647556e-260\n",
      "0.961 0.0 2.5407633069401396e-264\n",
      "0.962 0.0 1.2126462103370557e-268\n",
      "0.963 0.0 5.787673442181449e-273\n",
      "0.964 0.0 2.7623195939417405e-277\n",
      "0.965 0.0 1.3183897839611574e-281\n",
      "0.966 0.0 6.292362499491465e-286\n",
      "0.967 0.0 3.00319573973375e-290\n",
      "0.968 0.0 1.4333542690658529e-294\n",
      "0.969 0.0 6.841060785572422e-299\n",
      "0.97 0.0 3.265076449131964e-303\n",
      "0.971 0.0 1.5583437353985412e-307\n",
      "0.972 0.0 7.43760593508e-312\n",
      "0.973 0.0 3.54979334e-316\n",
      "0.974 0.0 1.694e-320\n",
      "0.975 0.0 0.0\n",
      "0.976 0.0 0.0\n",
      "0.977 0.0 0.0\n",
      "0.978 0.0 0.0\n",
      "0.979 0.0 0.0\n",
      "0.98 0.0 0.0\n",
      "0.981 0.0 0.0\n",
      "0.982 0.0 0.0\n",
      "0.983 0.0 0.0\n",
      "0.984 0.0 0.0\n",
      "0.985 0.0 0.0\n",
      "0.986 0.0 0.0\n",
      "0.987 0.0 0.0\n",
      "0.988 0.0 0.0\n",
      "0.989 0.0 0.0\n",
      "0.99 0.0 0.0\n",
      "0.991 0.0 0.0\n",
      "0.992 0.0 0.0\n",
      "0.993 0.0 0.0\n",
      "0.994 0.0 0.0\n",
      "0.995 0.0 0.0\n",
      "0.996 0.0 0.0\n",
      "0.997 0.0 0.0\n",
      "0.998 0.0 0.0\n",
      "0.999 0.0 0.0\n",
      "1.0 0.0 0.0\n"
     ]
    }
   ],
   "source": [
    "epsilonMu=5\n",
    "leader_probs=[]\n",
    "follower_probs=[]\n",
    "leader_payoffs=[]\n",
    "follower_payoffs=[]\n",
    "\n",
    "\n",
    "for FS in range(1001):\n",
    "    \n",
    "    guessl=1\n",
    "    guessf=1\n",
    "\n",
    "    mu=0\n",
    "    \n",
    "    if FS==0:\n",
    "        prob=.5\n",
    "        mu=0\n",
    "        for i in range(200):\n",
    "            [prob,payoff]=last_period_0(0,[prob])\n",
    "            mu=mu+epsilonMu\n",
    "        leader_probs.append(prob)\n",
    "        follower_probs.append(prob)\n",
    "        leader_payoffs.append(payoff)\n",
    "        follower_payoffs.append(payoff)\n",
    "        print(.001*FS,prob,prob)\n",
    "    \n",
    "    if FS>0:\n",
    "        for i in range(200):\n",
    "            [guessl,guessf,payoffL,payoffF]=last_period(.001*FS,[guessl,guessf])\n",
    "            mu=mu+epsilonMu\n",
    "        leader_probs.append(guessl)\n",
    "        follower_probs.append(guessf)\n",
    "        leader_payoffs.append(payoffL)\n",
    "        follower_payoffs.append(payoffF)\n",
    "        print(.001*FS,guessl,guessf)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('Alternative_Follower_Prob_Period_%s_%s_%s_%s.pkl'%(period,N,v,c), 'wb') as f:\n",
    "    pickle.dump(follower_probs,f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('Alternative_Leader_Prob_Period_%s_%s_%s_%s.pkl'%(period,N,v,c), 'wb') as f:\n",
    "    pickle.dump(leader_probs,f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('Alternative_Follower_Payoffs_Period_%s_%s_%s_%s.pkl'%(period,N,v,c), 'wb') as f:\n",
    "    pickle.dump(follower_payoffs,f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('Alternative_Leader_Payoffs_Period_%s_%s_%s_%s.pkl'%(period,N,v,c), 'wb') as f:\n",
    "    pickle.dump(leader_payoffs,f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
